package com.gzhryc.shared_device.oem.code.member.dao.db;

import com.gzhryc.common.NumberTools;
import com.gzhryc.jdbc.annotaion.*;
import com.gzhryc.shared_device.oem.code.member.dao.enums.MemberWalletEnum;

import java.io.Serializable;
import java.util.Date;

@NumberBranchTable(keyFieldName = "memberId")
@Table(name = "member_wallet")
public class MemberWallet implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id(auto = false)
	@Column(name = "member_id", note = "会员ID")
	protected Long memberId;

	@Column(name = "money", notNull = true, defVal = "0", note = "钱包余额，精确到厘")
	protected Long money;

	@Column(name = "freeze_money", notNull = true, defVal = "0", note = "冻结的金额，精确到厘")
	protected Long freezeMoney;

	@Column(name = "virtual_money", notNull = true, defVal = "0", note = "虚拟货币")
	protected Long virtualMoney;

	@Column(notNull = true, defVal = "1",note = "可操作，1:可用，2:不可用")
	protected Integer state;

	@Column(name = "last_update_date", note = "最后一次修改余额时间")
	protected Date lastUpdateDate;

	@Column(name = "last_update_vm_date", note = "最后一次修改虚拟货币数据")
	protected Date lastUpdateVmDate;

	@Column(name = "update_date", autoUpdateTime = true)
	protected Date updateDate;

	@Column(name = "create_date")
	protected Date createDate;

	public Long getMemberId() {
		return memberId;
	}

	public void setMemberId(Long memberId) {
		this.memberId = memberId;
	}

	public Long getMoney() {
		return money;
	}

	public void setMoney(Long money) {
		this.money = money;
	}

	public Long getFreezeMoney() {
		return freezeMoney;
	}

	public void setFreezeMoney(Long freezeMoney) {
		this.freezeMoney = freezeMoney;
	}

	public Long getVirtualMoney() {
		return virtualMoney;
	}

	public void setVirtualMoney(Long virtualMoney) {
		this.virtualMoney = virtualMoney;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Date lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public Date getLastUpdateVmDate() {
		return lastUpdateVmDate;
	}

	public void setLastUpdateVmDate(Date lastUpdateVmDate) {
		this.lastUpdateVmDate = lastUpdateVmDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getMoneyStr() {
		return NumberTools.getMoneyLiStr(this.money);
	}

	public String getFreezeMoneyStr() {
		return NumberTools.getMoneyLiStr(this.freezeMoney);
	}

	public String getStateName(){
		return MemberWalletEnum.State.note(this.state);
	}
}
